﻿@model LCTMoodle.Models.ViewModels.KhoaHocViewModel

<link href="~/Content/froala/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="~/Content/froala/css/froala_editor.min.css" rel="stylesheet" type="text/css" />
<link href="~/Content/froala/css/themes/gray.min.css" rel="stylesheet" type="text/css" />
<script src="~/Content/froala/js/froala_editor.min.js"></script>
<script src="~/Content/froala/js/plugins/colors.min.js"></script>
<script src="~/Content/froala/js/plugins/font_size.min.js"></script>
<script src="~/Content/froala/js/plugins/lists.min.js"></script>

<script>
    $('#viet-bai').editable({
        inlineMode: false,
        buttons: ['bold', 'italic', 'underline', 'fontSize', 'color', 'align', 'formatBlock', 'insertOrderedList', 'insertUnorderedList', 'createLink', 'insertImage'],
        zIndex: 3,
        theme: 'gray',
        blockTags: ['p', 'pre', 'blockquote']
    });
</script>

@{
    //Lấy chức năng quyền
    string quyen = ((Dictionary<int, string>)Session["Quyen"])[Model.ma];

    bool coTheTaoTaiLieu = quyen.IndexOf("|13|") != -1;
    
    //Người dùng chưa đăng nhập
    if (coTheTaoTaiLieu && Session["NguoiDung"] == null)
    {
        coTheTaoTaiLieu = false;
    }
}
<script>
    maKhoaHoc = '@Model.ma';
</script>
<script src="~/Content/script/KhoaHoc/Nhom_TaiLieu.js"></script>
<link href="~/Content/css/KhoaHoc/Nhom_TaiLieu.css" type="text/css" rel="stylesheet" />

@if(coTheTaoTaiLieu)
{
    <section class="compose-link-container">
        <a id="duong-dan-soan-tai-lieu" data-href="#soan-tai-lieu" data-focus="#tieu-de-bai-viet">Soạn tài liệu</a>
    </section>
}

<section id="tai-lieu-bai-viet" class="article-container">
    
</section>

@if(coTheTaoTaiLieu)
{
    <section class="compose-container">
        <form id="soan-tai-lieu" class="compose" method="post" enctype="multipart/form-data" action="/BaiViet/KhoaHoc_Nhom_TaiLieu_ThemBaiViet" novalidate="novalidate">
            <input type="hidden" name="MaKhoaHoc" value="@Model.ma"/>
            <input id="tieu-de-bai-viet" name="TieuDe" class="title-editor" placeholder="Nhập tiêu đề..." />
            <textarea id="viet-bai" name="NoiDung" class="editor" placeholder="Viết bài..."></textarea>
            <section class="attach-file-container">
                <section class="attach-file-button-container">
                    <i class="pe-7s-paperclip"></i>
                    <span class="text-attach-file">Thêm tập tin</span>
                </section>
                <section class="cancel-attach-file">
                    <i class="pe-7s-close-circle"></i>
                </section>
                <input class="attach-file" name="TapTin" type="file" hidden="hidden" />
            </section>
            <section class="post-button-container">
                <i class="pe-7s-check"></i>
                <input type="submit" value="Đăng" class="post-button" />
            </section>        
        </form>
    </section>
}